package com.yao.presenter;

import android.arch.lifecycle.LifecycleOwner;
import com.base.mvp.IModel;
import com.base.mvp.IView;
import com.yao.AppConfig;
import com.yao.http.Result;
import com.yao.presenter.bean.UserBean;
import io.reactivex.Flowable;
import okhttp3.RequestBody;
import retrofit2.http.*;

public interface UserContract {

    interface Model extends IModel<UserContract.Api> {
        Flowable<Result<UserBean>> login(String un, String psd);
    }

    interface View extends IView {
        void onSuccess();

        void onFail(int code, String msg);

        LifecycleOwner bindLifecycleOwner();
    }

    interface Presenter {
        void login(String un, String psd);
    }

    interface Api {
        @Headers({"Tag:" + AppConfig.Http.API_LOGIN})
        @POST(AppConfig.Http.API_LOGIN)
        Flowable<Result<UserBean>> login(@Body RequestBody body);
    }
}
